package com.allen.module_main


//import com.jzxiang.pickerview.TimePickerDialog;
import android.os.Build
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.allen.common.*
import com.allen.common.provide.ISettingProvide
import com.allen.common.provide.IUserProvide
import com.allen.common.utils.LogUtils
import com.allen.module_main.databinding.ModuleWorkActBinding
import com.allen.module_setting.SettingConstance


class ModuleWorkAct : BaseAct<ModuleWorkActBinding, ModuleWorkVM>() {
//    var mDialogAll: TimePickerDialog? = null
//    var mDialogYearMonth: TimePickerDialog? = null
//    var mDialogYearMonthDay: TimePickerDialog? = null
//    var mDialogMonthDayHourMinute: TimePickerDialog? = null
//    var mDialogHourMinute: TimePickerDialog? = null
    @JvmField
    @Autowired(name = BaseConst.FIND_SETTING)
    var settingProvider: ISettingProvide? = null

    @JvmField
    @Autowired(name = BaseConst.FIND_USER)
    var userInfoProvide: IUserProvide? = null

    override fun getResId(): Int {
        return R.layout.module_work_act
    }

    override fun initData() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
            mVm.version.value =
                PhoneUtils.getPackInfo(mContext)?.versionName + "  --  " + PhoneUtils.getPackInfo(
                    mContext
                )?.longVersionCode
        } else {
            mVm.version.value =
                PhoneUtils.getPackInfo(mContext)?.versionName + "  --  " + PhoneUtils.getPackInfo(
                    mContext
                )?.versionCode
        }


    }
    var lists:ArrayList<ArrayList<WorkBean>> = ArrayList()
    override fun initView() {
        LogUtils.e("SettingConstance.SETTING_INDEX = " + SettingConstance.SETTING_INDEX)
        if (settingProvider != null) {
//            settingProvider?.navPath()
            ToastUtilsSingle.showToast("有设置服务")
        } else {
            ToastUtilsSingle.showToast("没有设置服务")
        }
        if (userInfoProvide != null) {
//            settingProvider?.navPath()
            ToastUtilsSingle.showToast("有用户服务")
        } else {
            ToastUtilsSingle.showToast("没有用户服务")
        }


        var list1:ArrayList<WorkBean> = ArrayList()
        var list2:ArrayList<WorkBean> = ArrayList()
        var list3:ArrayList<WorkBean> = ArrayList()

        for (i in 0..7){
            list1.add(WorkBean())
            list2.add(WorkBean())
            list3.add(WorkBean())
        }
        lists.add(list1)
        lists.add(list2)
        lists.add(list3)
        // 设置数据
//        var page:ViewPager = mbinding
//        page.adapter = WorkViewPagerAdapter(this,lists)
//        page.offscreenPageLimit = 2

    }

    override fun initObserve() {
    }

    override fun bindingVM() {
        mbinding.baseVM = mVm
    }

    override fun getBaseViewModelClass(): Class<ModuleWorkVM> {
        return return ModuleWorkVM::class.java
    }

    override fun initEvent() {
        mbinding.btn2.setOnClickListener {
            settingProvider?.navPath()
        }
        mbinding.btn3.setOnClickListener {
            userInfoProvide?.navPath()
        }
    }

}